<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI 手势密码</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>HUI 手势密码</h1>
</header>
<div class="hui-wrap">
    <div class="hui-center-title" style="margin-top:15px;"><h1>演示样例</h1></div>
    <div>
        <div id="H5LockIn" style="width:90%; margin:0 auto;"></div>
    </div>
    <div style="padding-top:30px; color:#666666; line-height:30px; text-align:center;" onclick="redo();">重新绘制</div>
</div>
<script type="text/javascript" src="../js/hui.js" charset="UTF-8"></script>
<script src="../js/hui-touch-pwd.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var pwdres = null;
hui.ready(function(){
    var domInfo = hui('#H5LockIn').width();
    var looker = new huiTouchPwd({width:domInfo, height:domInfo, pointNum:3, wrapDiv:"H5LockIn"}, function(pwd){
        if(pwd.length < 4){
            hui.toast('密码至少包含4个点');
            return false;
        }
        if(!pwdres){
            pwdres = pwd;
            hui.toast('请再次输入密码');
            return false;
        }
        if(pwdres != pwd){
            hui.toast('2次密码不一致');
            return false;
        }
        hui.toast('设置成功 '+ pwd);
    });
});
function redo(){
    pwdres = null;
    hui.toast('请重新绘制密码');
}
</script>
</body>
</html>